﻿
using Microsoft.Extensions.DependencyInjection;
using YS.K12.Application.IoT.Service.ReplyCommand;
using YS.K12.Application.IoT.Service;
using YS.K12.Application.IoT.Service.Http;
using Flurl.Http.Configuration;
using Microsoft.Extensions.DependencyInjection;
using YS.Domain.IoT.Option;
using YS.K12.Application.IoT.RedisHub;
using Flurl.Http;

namespace YS.K12.IoT.Startup
{
    public static class ApplicationBuilder
    {
        public static void AddInjection(this IServiceCollection services)
        {
            // 注册 FlurlClient 或 IFlurlClient 到服务容器中
           var remoteIPHost = AppSettingsHelper.GetContent("IHttp", "Vend", "Address");
            services.AddSingleton<IFlurlClientCache>(
            sp =>
            new FlurlClientCache()
            .Add("CoreIntegration", remoteIPHost)
            );
            // 注册Socket集群
            services.AddSingleton<RedisHubLifetimeManager>();
            // 注册 IHttpb
            services.AddTransient<IHttp, HttpService>();
            //服务依赖注入
            services.AddTransient<IReplyCommandService, ReplyCommandService>();
            
        }
    }
}
